package com.moleq.mgnetwork;

import java.io.File;

import android.content.Context;

public class Constant {

	public final static String DATABASE_NAME = "mpos.db";
	public static final String DB_PACKAGE_NAME = "com.moleq.posdb";
	public static final String MGPOS_DB_PATH = "/data/data/com.moleq.posdb/databases/mpos.db";
	public static final int FILE_HANDLER_PORT = 6678;
	public static final int CMM_PORT = 6677;
	public static final String CMD_SEND_FILE = "com.ming.cmdsendfile";
	public static final String CMD_CONNECT = "com.ming.connect";
	public static int bufferSize = 256;
	
	
	public static final int readBufferSize = 4096;
	public static final String CMD_RESPONSE = "com.ming.cmd.reponse";
	public static final String CMD_REQUEST = "com.ming.cmd.request";
	public static final String CMD_UPDATE_ME = "com.ming.cmd.updateme";
	public static final String CMD_PING_IP = "com.ming.cmd.ping.ip";

	
	public static final String startServiceAction = "com.ming.startServiceAction";
	public static final String stopServiceAction = "com.ming.stopServiceAction";
	public static final String bootCompletedAction = "android.intent.action.BOOT_COMPLETED";
	public static final int MY_LOACL_IP = 0;
	

	
	public static String IN_BOX = "/inbox/";
	public static String OUT_BOX = "/outbox/";
	public static int SERVER_PORT = 6677;
	public static int SEND_FILE_PORT = 6688;
	public static String APP_PATH = "";
	public static String SDCARD = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();

	public static String SDCARD_IN_BOX = SDCARD + "/MoleQ/" + IN_BOX;
	public static String SDCARD_OUT_BOX = SDCARD + "/MoleQ/" + OUT_BOX;
	public static final String SDCARD_MGPOS_CACHE = SDCARD + "/MoleQ/cache/";
	protected static final String ANALYZED_XML_FILE_NAME = "Task%s%s.xml";

	public static File IN_FOLDER = new File(SDCARD_IN_BOX);
	public static File OUT_FOLDER = new File(SDCARD_OUT_BOX);
	public static Context shareContext = null;
	
	
	public static Context getShareContext(Context context) {
		
		Context sharedContext = null;
		try {
			sharedContext = context.createPackageContext(DB_PACKAGE_NAME,
					Context.CONTEXT_IGNORE_SECURITY);
			if (sharedContext == null) {
				return context;
			}
		} catch (Exception e) {
			String error = e.getMessage();
			return context;
		}
				
		return sharedContext;
	}
}
